#include<iostream>
using namespace std;

template <class T>
bool myCampare(T a, T b)
{
  if (a == b) {
    return true;
  }
  return false;
}

class Person {
  public:
    Person(int age, string name)
    {
      m_age = age;
      m_name = name;
    }
    int m_age;
    string m_name;
};
// 利用具体化Person版本实现代码，具体优化调用
template<> bool myCampare(Person p1, Person p2)
{
  if (p1.m_name == p2.m_name && p1.m_age == p2.m_age)
  {
    return true;
  }
  return false;
}

void test0() {
  int a = 30;
  int b = 20;
  cout << myCampare(a, b) <<endl;
};

void test1() {
  Person p1(29, "xl");
  Person p2(29, "xl");
  cout << myCampare(p1, p2) <<endl;  //有具体的template<> bool myCampare(Person p1, Person p2)，优先调用
};

int main() {
  // test0();
  test1();
  return 0;
}